package com.imooc.dto.address;

import com.imooc.common.constants.ResultCodeConstants;
import com.imooc.common.exception.ValidateException;
import com.imooc.common.result.AbstractRequest;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/**
 * @ClassName: UpdateAddressDefaultRequest
 * @Description:
 * @author: limingxing
 * @Date: 2019-12-26 14:31
 */
@Data
@ApiModel(value = "修改用户默认地址请求参数")
public class UpdateAddressDefaultRequest extends AbstractRequest {
    @ApiModelProperty(value = "关联用户id")
    private String userId;
    @ApiModelProperty(value = "地址主键id")
    private String addressId;


    @Override
    public void requestCheck() {
        if (StringUtils.isBlank(userId) || StringUtils.isBlank(addressId)) {
            throw new ValidateException(ResultCodeConstants.REQUISITE_PARAMETER_NOT_EXIST.getCode(),
                    ResultCodeConstants.REQUISITE_PARAMETER_NOT_EXIST.getMessage());
        }
    }
}
